package com.itic.ht.mem.member.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itic.appbase.framework.common.constants.DBConst;
import com.itic.appbase.framework.common.service.HtCrudService;
import com.itic.ht.mem.member.persistence.dao.WebMemberDao;
import com.itic.ht.mem.member.persistence.model.WebMember;
import com.itic.ht.mem.member.persistence.model.WebMemberExample;


@Service
@Transactional
public class WebMemberService extends HtCrudService<WebMemberDao,WebMember,WebMemberExample> {
    @Autowired
    private WebMemberDao webMemberDao;

	public String deltrue(Integer id) {
		int result = webMemberDao.deleteByPrimaryKey(id);
		if(result>0){
    		return SUCCESS;
    	}else{
    		return FAILED;
    	}
	}
	public WebMember getMemberByAccount(String account) {
		WebMember member = null;
		try {
			WebMemberExample example = new WebMemberExample();
			example.createCriteria().andAccountEqualTo(account).andDelFlagEqualTo(Integer.parseInt(DBConst.TRUE));
			List<WebMember> members = webMemberDao.selectByExample(example);
			System.out.println("用户信息个数:"+members.size());
			member = members.get(0);
			return member;
		} catch (Exception e) {
			return null;
		}
	}

}